﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MhAdmin.Application.Services.Students;
using MhAdmin.Application.Services.Students.Dto;
using MhAdmin.System.Entity;

namespace MhAdmin.Web.Core.Controllers.System.Studentss
{
    [ApiDescriptionSettings("业务",Tag ="学生管理")]
    public class StudentController:BaseController
    {
        private readonly IStudentServices _stu;

        public StudentController(IStudentServices stu)
        {
            _stu = stu;
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpPost("add")]
        public async Task Add([FromBody]StudentAddInput input)
        {
            await _stu.Add(input);
        }
        /// <summary>
        /// 显示分页
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<dynamic> Page([FromQuery] PageStudentInput input)
        {
            return await _stu.Page(input);
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="delete"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpPost]
        public async Task DeleteStudent([FromBody] List<DeleteStudent> delete)
        {
            await _stu.Delete(delete);
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="edit"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpPost]
        public async Task Edit(EditStudent edit)
        {
            await _stu.Edit(edit);
        }
        /// <summary>
        /// 单条id查询
        /// </summary>
        /// <param name="student"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpGet]
        public async Task<Student> GetStudentById([FromQuery] DeleteStudent student)
        {
            return await _stu.GetStudentById(student);
        }
        
    }
}
